using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MatchCore;

public class UITransformHelper
{
    public static UnityEngine.Vector2 GetUISceneSize()
    {
        var uiRoot = GameUtils.Instance().UiRoot;
        if(uiRoot)
        {
            var rectTran = (RectTransform)uiRoot.transform;
            return new UnityEngine.Vector2(rectTran.rect.width,rectTran.rect.height); 
        }

        return new UnityEngine.Vector2(826,430);
    }

    public static UnityEngine.Vector3 Match2UIPosition(MatchCore.Vector2 pos)
    {   
        var UISceneSize = GetUISceneSize();

        UnityEngine.Vector3 v = new UnityEngine.Vector3(0,0,0);
        v.x = UISceneSize.x / Config.SCENE_SIZE.x * pos.x;
        v.y = UISceneSize.y - UISceneSize.y / Config.SCENE_SIZE.y * pos.y;
        return v;
    }
}